Function Reference

_Singleton

Check if no other occurrence is running.

#include <Misc.au3>
_Singleton($occurrenceName [,$flag=0 )))

 

Parameters

$occurrenceName string to identify the occurrence of the script
$flag when 1 the function return on error

 

Return Value

On Flag = 1 otherwise the script is exited
Success: Returns 1
Failure: Returns 0

 

Remarks

If an occurrence is already found the script is exited.

The second call to the function in the same running script will fail.

 

Related

None.

 

Example


#include "Misc.au3"
if _Singleton("test\test",1) = 0 Then
    Msgbox(0,"Warning","An occurence of test is already running")
    Exit
EndIf
Msgbox(0,"OK","the first occurence of test is running")